﻿<UserControl x:Class="NuGet.Client.VisualStudio.UI.PackageManagerControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:Tools="clr-namespace:NuGet.Client.VisualStudio.UI"
             xmlns:resx="clr-namespace:NuGet.Client.VisualStudio.UI.Resources"
             xmlns:tp="clr-namespace:Microsoft.VisualStudio.ExtensionsExplorer.UI;assembly=Microsoft.VisualStudio.ExtensionsExplorer.UI"
             Background="{DynamicResource {x:Static resx:Brushes.HeaderBackground}}"
             Foreground="{DynamicResource {x:Static resx:Brushes.UIText}}"
             x:Name="_self"
             mc:Ignorable="d"
             d:DesignHeight="523" d:DesignWidth="900">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources.xaml" />                
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <UserControl.CommandBindings>
        <CommandBinding
            Command="{x:Static Tools:Commands.FocusOnSearchBox}"
            Executed="FocusOnSearchBox_Executed" />
    </UserControl.CommandBindings>
    <UserControl.InputBindings>
        <KeyBinding Command="{x:Static Tools:Commands.FocusOnSearchBox}" Gesture="CTRL+E" />
    </UserControl.InputBindings>
    <Grid>
        <Grid x:Name="_root">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <!-- Row 0 is used by restore bar -->

            <TextBlock 
                Grid.Row="1" 
                x:Name="_label" 
                FontSize="{Binding ElementName=_self,Path=FontSize,Converter={StaticResource Font155PercentSizeConverter}}" 
                Margin="8,8">Package Manager</TextBlock>

            <WrapPanel Grid.Row="2" Margin="0,12,0,20" Orientation="Horizontal">
                <StackPanel Orientation="Horizontal" Margin="24,8,0,0">
                    <TextBlock
                        Grid.Column="0"
                        VerticalAlignment="Center"
                        Text="{x:Static resx:Resources.Label_Repository}" />

                    <ComboBox
                        Margin="6,0,0,0"
                        x:Name="_sourceRepoList"
                        VerticalAlignment="Center"
                        DisplayMemberPath="Name"
                        MinWidth="130"
                        MinHeight="22"
                        Grid.Column="1"
                        SelectionChanged="_sourceRepoList_SelectionChanged"
                        Style="{StaticResource {ComponentResourceKey TypeInTargetAssembly={x:Type tp:AutomationComboBox}, ResourceId=ThemedComboBoxStyle}}" />

                    <TextBlock
                        Grid.Column="2"
                        Margin="24,0,0,0"
                        VerticalAlignment="Center"
                        Text="{x:Static resx:Resources.Label_Filter}" />

                    <ComboBox
                        Grid.Column="3"
                        Margin="6,0,0,0"
                        VerticalAlignment="Center"
                        SelectedIndex="0"
                        x:Name="_filter"
                        MinWidth="130"
                        MinHeight="22"
                        SelectionChanged="_filter_SelectionChanged"
                        Style="{StaticResource {ComponentResourceKey TypeInTargetAssembly={x:Type tp:AutomationComboBox}, ResourceId=ThemedComboBoxStyle}}" />

                    <CheckBox 
                        x:Name="_checkboxPrerelease"
                        Grid.Column="4" Margin="24,0,0,0"
                        VerticalAlignment="Center"
                        Content="{x:Static resx:Resources.Checkbox_IncludePrerelease}"
                        Foreground="{DynamicResource {x:Static resx:Brushes.UIText}}"
                        VerticalContentAlignment="Center"
                        Checked="_checkboxPrerelease_CheckChanged"
                        Unchecked="_checkboxPrerelease_CheckChanged" IsChecked="True" />
                </StackPanel>

                <StackPanel Orientation="Horizontal" Margin="24,8,0,0" MinHeight="24">
                    <Border 
                        Grid.Column="6"
                        VerticalAlignment="Center"
                        x:Name="_searchControlParent"
                        MinHeight="22"
                        MinWidth="224" />   
                     
                    <Button
                        Margin="24,0"
                        VerticalAlignment="Center"
                        Padding="0"
                        Grid.Column="7"
                        Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
                        Click="SettingsButtonClick" x:Name="_settingsButton">
                        <Rectangle 
                            Width="{Binding ElementName=_self,Path=FontSize,Converter={StaticResource Font122PercentSizeConverter}}" 
                            Height="{Binding ElementName=_self,Path=FontSize,Converter={StaticResource Font122PercentSizeConverter}}">
                            <Rectangle.Fill>
                                <DrawingBrush>
                                    <DrawingBrush.Drawing>
                                        <DrawingGroup>
                                            <DrawingGroup.Children>
                                                <GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
                                                <GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M15.9434,7.0796L15.8734,6.4596 13.6374,5.6646 14.6544,3.5256 14.2684,3.0376C13.8854,2.5536,13.4464,2.1146,12.9644,1.7316L12.4754,1.3456 10.3354,2.3626 9.5414,0.1286 8.9224,0.057599999999999C8.6194,0.0215999999999994 8.3124,-0.000400000000000844 8.0004,-0.000400000000000844 7.6894,-0.000400000000000844 7.3824,0.0215999999999994 7.0804,0.0565999999999995L6.4614,0.126599999999999 5.6664,2.3626 3.5254,1.3456 3.0374,1.7316C2.5554,2.1126,2.1164,2.5516,1.7324,3.0366L1.3454,3.5246 2.3624,5.6646 0.1274,6.4596 0.0564,7.0796C0.0224000000000011,7.3816 0.000400000000000844,7.6876 0.000400000000000844,7.9996 0.000400000000000844,8.3116 0.0224000000000011,8.6186 0.0564,8.9206L0.1274,9.5396 2.3624,10.3346 1.3454,12.4746 1.7324,12.9626C2.1144,13.4466,2.5534,13.8846,3.0374,14.2676L3.5254,14.6556 5.6664,13.6376 6.4614,15.8726 7.0804,15.9436C7.3824,15.9786 7.6894,15.9996 8.0004,15.9996 8.3134,15.9996 8.6204,15.9786 8.9244,15.9426L9.5424,15.8706 10.3364,13.6366 12.4754,14.6556 12.9644,14.2676C13.4484,13.8836,13.8874,13.4446,14.2684,12.9616L14.6544,12.4736 13.6374,10.3346 15.8734,9.5396 15.9434,8.9206C15.9784,8.6186 16.0004,8.3116 16.0004,7.9996 16.0004,7.6876 15.9784,7.3816 15.9434,7.0796" />
                                                <GeometryDrawing Brush="#FF414141" Geometry="F1M8,5C6.343,5 5,6.343 5,8 5,9.657 6.343,11 8,11 9.657,11 11,9.657 11,8 11,6.343 9.657,5 8,5 M12.714,9.603C12.644,9.81,12.563,10.01,12.468,10.203L13.484,12.342C13.149,12.766,12.767,13.148,12.343,13.484L10.203,12.467C10.01,12.563,9.81,12.643,9.603,12.714L8.808,14.949C8.542,14.98 8.273,15 8,15 7.728,15 7.459,14.98 7.194,14.95L6.399,12.715C6.192,12.644,5.991,12.564,5.798,12.468L3.658,13.484C3.234,13.148,2.852,12.766,2.516,12.342L3.532,10.203C3.437,10.01,3.356,9.81,3.286,9.603L1.05,8.807C1.02,8.542 1,8.273 1,8 1,7.727 1.02,7.458 1.05,7.193L3.286,6.397C3.356,6.19,3.437,5.991,3.532,5.797L2.516,3.658C2.852,3.234,3.234,2.851,3.658,2.516L5.798,3.532C5.991,3.436,6.191,3.356,6.399,3.286L7.194,1.05C7.459,1.02 7.728,1 8,1 8.273,1 8.542,1.02 8.808,1.05L9.603,3.287C9.81,3.357,10.01,3.437,10.203,3.533L12.343,2.516C12.767,2.852,13.149,3.235,13.484,3.658L12.468,5.797C12.563,5.991,12.644,6.19,12.714,6.397L14.95,7.193C14.98,7.458 15,7.727 15,8 15,8.273 14.98,8.542 14.95,8.807z" />
                                                <GeometryDrawing Brush="#FF414141" Geometry="F1M9.5,8C9.5,8.828 8.829,9.5 8,9.5 7.171,9.5 6.5,8.828 6.5,8 6.5,7.172 7.171,6.5 8,6.5 8.829,6.5 9.5,7.172 9.5,8" />
                                                <GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M8,9.5C7.172,9.5 6.5,8.828 6.5,8 6.5,7.172 7.172,6.5 8,6.5 8.828,6.5 9.5,7.172 9.5,8 9.5,8.828 8.828,9.5 8,9.5 M8,5C6.343,5 5,6.343 5,8 5,9.656 6.343,11 8,11 9.657,11 11,9.656 11,8 11,6.343 9.657,5 8,5" />
                                            </DrawingGroup.Children>
                                        </DrawingGroup>
                                    </DrawingBrush.Drawing>
                                </DrawingBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                    </Button>
                </StackPanel>
            </WrapPanel>
            <Border Grid.Row="3" BorderThickness="0,1,0,0" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition MinWidth="300" />
                        <ColumnDefinition Width="auto" />
                        <ColumnDefinition MinWidth="300" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Tools:InfiniteScrollList x:Name="_packageList" SelectionChanged="PackageList_SelectionChanged">
                    </Tools:InfiniteScrollList>

                    <StackPanel
                        Grid.Row="1"
                        Grid.Column="0"
                        Orientation="Vertical"
                        Background="{DynamicResource {x:Static resx:Brushes.LegalMessageBackground}}">
                        <TextBlock
                        Margin="24,12"
                        TextWrapping="Wrap"
                        Text="{x:Static resx:Resources.Text_LegalDisclaimer}" />
                    </StackPanel>

                    <GridSplitter Grid.Column="1" Width="5"
                                  Grid.RowSpan="2"
                                  HorizontalAlignment="Center"
                                  VerticalAlignment="Stretch"
                                  BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}"
                                  BorderThickness="1,0" />
                    <Tools:DetailControl
                        x:Name="_packageDetail"
                        Grid.Column="2"
                        Grid.RowSpan="2" />
                </Grid>
            </Border>
        </Grid>
    </Grid>
</UserControl>